package cn.enjoy.oom;

import org.springframework.cglib.proxy.Enhancer;
//import net.sf.cglib.cn.enjoy.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

public class MetaspaceOOM {

    static class OOMObject{}

    public static void main(String[] args) {
        while (true) {
            Enhancer enhancer = new Enhancer();
            enhancer.setSuperclass(OOMObject.class);
            enhancer.setUseCache(false);
//            enhancer.setCallback(new MethodInterceptor() {
//                public Object intercept(Object obj, Method method,
//                                        Object[] args, MethodProxy cn.enjoy.proxy) throws Throwable {
//                    return cn.enjoy.proxy.invokeSuper(obj, args);
//                }
//            });
            enhancer.create();
        }
    }

}